package com.turing.post.report.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

@SuppressWarnings("serial")
@Entity
@Table(name = "MerchantDaySettlement")
@IdClass(MerchantDaySettlement.class)
public class MerchantDaySettlement implements Serializable {

	public MerchantDaySettlement() {
		super();
	}

	/**
	 * 发卡商NO
	 */
	private String issueCompanyNo;
	/**
	 * 商户号
	 */
	private String merchantNo;
	/**
	 * 帐务日期
	 */
	private Date tranDate;
	/**
	 * 本日消费
	 */
	private BigInteger consume = BigInteger.ZERO;
	/**
	 * 本日消费其他金额
	 */
	private BigInteger otherPaid = BigInteger.ZERO;
	/**
	 * 本日消费笔数
	 */
	private BigInteger consumeCount = BigInteger.ZERO;
	/**
	 * 本日充值
	 */
	private BigInteger deposit = BigInteger.ZERO;
	/**
	 * 本日充值笔数
	 */
	private BigInteger depositCount = BigInteger.ZERO;
	/**
	 * 本日退货
	 */
	private BigInteger cancelPaid = BigInteger.ZERO;
	/**
	 * 本日退货笔数
	 */
	private BigInteger cancelPaidCount = BigInteger.ZERO;
	/**
	 * 持卡人手续费(>0)或折扣(<0)
	 */
	private BigInteger fee = BigInteger.ZERO;
	/**
	 * 结算比率
	 */
	private BigInteger settRatio = BigInteger.ZERO;
	/**
	 * 本日手续费收入
	 */
	private BigInteger income = BigInteger.ZERO;
	/**
	 * 本日成本
	 */
	private BigInteger cost = BigInteger.ZERO;
	/**
	 * 本日追溯历史手续费收入
	 */
	private BigInteger pastIncome = BigInteger.ZERO;
	/**
	 * 本日应付资金
	 */
	private BigInteger paidFund = BigInteger.ZERO;

	/**
	 * 销售商分成
	 */
	private BigInteger IssueFund = BigInteger.ZERO;

	@Column(name = "ISSUECOMPANYNO", nullable = false)
	public String getIssueCompanyNo() {
		return issueCompanyNo;
	}

	public void setIssueCompanyNo(String issueCompanyNo) {
		this.issueCompanyNo = issueCompanyNo;
	}

	@Id
	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return merchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		this.merchantNo = merchantNo;
	}

	@Id
	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	@Column(name = "CONSUME", nullable = false)
	public BigInteger getConsume() {
		return consume;
	}

	public void setConsume(BigInteger consume) {
		this.consume = consume;
	}

	@Column(name = "OTHERPAID", nullable = false)
	public BigInteger getOtherPaid() {
		return otherPaid;
	}

	public void setOtherPaid(BigInteger otherPaid) {
		this.otherPaid = otherPaid;
	}

	@Column(name = "CONSUMECOUNT", nullable = false)
	public BigInteger getConsumeCount() {
		return consumeCount;
	}

	public void setConsumeCount(BigInteger consumeCount) {
		this.consumeCount = consumeCount;
	}

	@Column(name = "DEPOSIT", nullable = false)
	public BigInteger getDeposit() {
		return deposit;
	}

	public void setDeposit(BigInteger deposit) {
		this.deposit = deposit;
	}

	@Column(name = "DEPOSITCOUNT", nullable = false)
	public BigInteger getDepositCount() {
		return depositCount;
	}

	public void setDepositCount(BigInteger depositCount) {
		this.depositCount = depositCount;
	}

	@Column(name = "CANCELPAID", nullable = false)
	public BigInteger getCancelPaid() {
		return cancelPaid;
	}

	public void setCancelPaid(BigInteger cancelPaid) {
		this.cancelPaid = cancelPaid;
	}

	@Column(name = "CANCELPAIDCOUNT", nullable = false)
	public BigInteger getCancelPaidCount() {
		return cancelPaidCount;
	}

	public void setCancelPaidCount(BigInteger cancelPaidCount) {
		this.cancelPaidCount = cancelPaidCount;
	}

	@Column(name = "FEE", nullable = false)
	public BigInteger getFee() {
		return fee;
	}

	public void setFee(BigInteger fee) {
		this.fee = fee;
	}

	@Column(name = "SETTRATIO", nullable = false)
	public BigInteger getSettRatio() {
		return settRatio;
	}

	public void setSettRatio(BigInteger settRatio) {
		this.settRatio = settRatio;
	}

	@Column(name = "INCOME", nullable = false)
	public BigInteger getIncome() {
		return income;
	}

	public void setIncome(BigInteger income) {
		this.income = income;
	}

	@Column(name = "COST", nullable = false)
	public BigInteger getCost() {
		return cost;
	}

	public void setCost(BigInteger cost) {
		this.cost = cost;
	}

	@Column(name = "PASTINCOME", nullable = false)
	public BigInteger getPastIncome() {
		return pastIncome;
	}

	public void setPastIncome(BigInteger pastIncome) {
		this.pastIncome = pastIncome;
	}

	@Column(name = "PAIDFUND", nullable = false)
	public BigInteger getPaidFund() {
		return paidFund;
	}

	public void setPaidFund(BigInteger paidFund) {
		this.paidFund = paidFund;
	}

	@Column(name = "ISSUEFUND", nullable = false)
	public BigInteger getIssueFund() {
		return IssueFund;
	}

	public void setIssueFund(BigInteger issueFund) {
		IssueFund = issueFund;
	}

	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] { getMerchantNo(),
				getTranDate() });
	}

	@Override
	public boolean equals(Object obj) {
		if ((this == obj))
			return true;
		if ((obj == null))
			return false;
		if (!(obj instanceof MerchantDaySettlement))
			return false;
		MerchantDaySettlement other = (MerchantDaySettlement) obj;

		if (!PCPSUtil
				.compareObject(this.getMerchantNo(), other.getMerchantNo()))
			return false;

		return PCPSUtil.compareObject(this.getTranDate(), other.getTranDate());
	}
}